﻿@using Utils;

@model WebUI.Models.BillingInfoViewModel
@{
    ViewBag.Title = "View Billing History - JuicyBasket";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="mainCol">
    <div class="profile">
        <div class="fl">
            <a href="@Url.Action("JobList")" title="@Model.Co.Name">
                <img class="avatar80" src="@Url.StaticFile(Model.AvatarUrl)" alt="@Model.Co.Name"/>
            </a>
        </div>
        <div class="fl">
            <h1>
                <span>@Model.Co.Name</span>
            </h1>
            
            <div class="profile-detail">
                @if (!string.IsNullOrEmpty(Model.Co.Location))
                {
                <div class="fl">
                    <a href="#" class="locality">@Model.Co.Location</a>
                </div>
                }
                @if (!string.IsNullOrEmpty(Model.Co.CoUrl))
                {
                <div class="fl">
                    <a href="@Model.Co.CoUrl" class="url" target="_blank">@Model.Co.CoUrl.ToDomainName()</a>
                </div>
                }
            </div>
            <div class="clear"></div>
            <div>
                <a class="action editaccount" href="/company/editprofile">
                    <span>Edit Account</span>
                </a>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <ul class="tabs">
        <li>
            <a href="@Url.Action("JobList")">Jobs</a>
        </li>
        <li class="active">
            <a href="@Url.Action("BillingHistory")">Billing History</a>
        </li>
        <li>
            <a href="@Url.Action("SavedTalent")">Saved Talent</a>
        </li>
        <li>
            <a href="@Url.Action("SavedJobs")">Saved Jobs</a>
        </li>
    </ul>
    <div class="tabsbottom"></div>
    <div class="clear"></div>
    @if (Model.BillingInfoList.Count > 0)
    {
        <div style="font-style:italic">* We store last 4 digits of your credit card only</div>
        <div id="billinghistory">
            <div class="jobrow jobrowtitle">
                <div class="jobcol col1">Description</div>
                <div class="jobcol col2">Amount($)</div>
                <div class="jobcol col3">Credit Card Last 4</div>
                <div class="jobcol col4">Card Type</div>
                <div class="jobcol col5">Purchase Date</div>
            </div>
            @foreach (var job in Model.BillingInfoList)
            {
                <div class="jobrow">
                    <div class="jobcol col1">
                        @WebUI.Utils.ViewModelUtils.GetBillingDescFromTransType(job.TransType)
                    </div>
                    <div class="jobcol col2">@job.TransAmount</div>
                    <div class="jobcol col3">**** **** **** @job.Last4</div>
                    <div class="jobcol col4">@job.CardType</div>
                    <div class="jobcol col5">
                        @job.CreateDate.ToDateTimeString()
                    </div>
                </div>
                
                <div class="clear"></div>
                
            }
        </div>
        
        <div class="clear"></div>
        
    }
    else
    { 
    <div class="null-message">
        <h2>No billing history. <a href="/job/post">Post a job listing?</a></h2>
    </div>
    }
    <div class="clear"></div>
</div>
<div class="sideCol">
    <div class="profile">
        <div class="jbblock">
            Remaining Job Credits: <span class="blue">@Model.Co.JobCredits</span>
        </div>
        <div class="clear"></div>
        <div class="smallspacer"></div>
        <div>
            <a class="action postjob" href="/job/post">
                <span>Post a Job</span>
            </a>
            <a class="action buycredits" href="/job/buycredits">
                <span>Buy Job Credits</span>
            </a>
        </div>
        
    </div>
    <div class="clear"></div>
    
    
    <div class="clear"></div>
</div>